<?php
include_once ('../global.php');
$time = $_POST['time'];
$type = $_POST['type'];

//I5
$sql="SELECT count(*) as count FROM `bmw_test_drive_sign` where  is_del=0 and type='".$type."' and  time='".$time."' and testtype='I5'";
$res=$db->SelectSQL($sql);
$used_num=$res?$res[0]['count']:0;
$testtype_limit_num=gettimes_testtype($type,"I5",$time);
$arr['I5']=[
    'total'=>$testtype_limit_num,
    'used'=>$used_num
];
//I7
$sql="SELECT count(*) as count FROM `bmw_test_drive_sign` where  is_del=0 and type='".$type."' and  time='".$time."' and testtype='I7'";
$res=$db->SelectSQL($sql);
$used_num=$res?$res[0]['count']:0;
$testtype_limit_num=gettimes_testtype($type,"I7",$time);
$arr['I7']=[
    'total'=>$testtype_limit_num,
    'used'=>$used_num
];
//IX
$sql="SELECT count(*) as count FROM `bmw_test_drive_sign` where  is_del=0 and type='".$type."' and  time='".$time."' and testtype='IX'";
$res=$db->SelectSQL($sql);
$used_num=$res?$res[0]['count']:0;
$testtype_limit_num=gettimes_testtype($type,"IX",$time);
$arr['IX']=[
    'total'=>$testtype_limit_num,
    'used'=>$used_num
];

echo json_encode($arr);
exit;
